import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class IOTest {
    public static void main(String[] args) {
        FileInputStream fis = null;
        FileOutputStream fos = null;
        byte [] arr = new byte[1024 * 1024];
        int inCount = 0;
        try {
            fis =new FileInputStream("C:\\Users\\HJY\\Desktop\\毕设材料\\1封面 (1).png");
            fos = new FileOutputStream("1封面 (1).png");
           while ((inCount = fis.read(arr)) != -1) {
               fos.write(arr,0,inCount);
               fos.flush();
           }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            if (fos != null) {
                try {
                    fos.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
